<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:apabb="http://apabb.org.br/jsf"
	xmlns:a4j="http://richfaces.org/a4j">


	<h:form id="formParticipante">
		<div style="position: relative; left: 11px; font-size: 120%;">
			<h2>#{label}</h2>
		</div>
		<hr size="3" style="left: 3px; background-color: #000080;" />

		<div id="buscaEntidade">
			<h:messages
				errorStyle="color: red;font-family: Arial; 
		font-size: 12px; position: relative; left: 10px;"
				showSummary="true" />
			<br />
			<fieldset styleClass="form" style="background-color: rgb(240, 250, 255)">
				<h:panelGrid columns="2" width="67%">
					<h:column rendered="#{cpfRequired}">
						<h:outputLabel for="cpf" value="* CPF: " title="CPF" />
					</h:column>
					<h:column rendered="#{!cpfRequired}">
						<h:outputLabel for="cpf" value="CPF: " title="CPF" />
					</h:column>
					<h:column>

						<h:inputText class="inputContrast"
							value="#{entidade.participante.cpf}"
							onkeyup="formataMascara('###.###.###-##', this)"
							onchange="formataMascara('###.###.###-##', this)" label="CPF"
							name="cpf" id="cpf" type="text" size="25" maxlength="14"
							required="#{cpfRequired}"
							alt="numero do CPF" disabled="#{entidade.participante.codigo != null}"
							converter="#{cpfConverter}" validator="#{cpfValidator.validate}">

							<a4j:ajax event="blur"
								listener="#{componentView.recuperarParticipante}"
								render="formParticipante" oncomplete="setFocus();"/>

						</h:inputText>

					</h:column>
					<h:column>
						<h:outputLabel for="nome" value="* Nome: " />
					</h:column>
					<h:column>
							<h:inputText required="true" class="inputContrast"
							value="#{entidade.participante.nome}" name="nome"
							id="nome" type="text" size="60" maxlength="70"
							disabled="#{entidade.participante.codigo != null}" label="Nome" />
							
					</h:column>

					<h:column>
						<h:outputLabel for="dataNascimento" value="* Data Nascimento: "
							title="Data Nascimento" />
					</h:column>
					<h:column>
						<rich:calendar required="true" styleClass="contractRich"
							label="Data Nascimento" name="dtNascimento" id="dtNascimento"
							value="#{entidade.participante.dtNascimento}"
							datePattern="dd/MM/yyyy" enableManualInput="true"
							oninputkeyup="formataMascara('##/##/####', this)"
							oninputchange="formataMascara('##/##/####', this)"
							disabled="#{entidade.participante.codigo != null}" maxlength="10">
							<!-- rich:placeholder value="dd/mm/yyyy" / -->
						</rich:calendar>
					</h:column>
					<h:column>
						<h:outputLabel for="nomeMae" value="* Nome da Mãe: " />
					</h:column>
					<h:column>
						<h:inputText required="true" class="inputContrast"
							value="#{entidade.participante.nomeMae}" name="nomeMae"
							id="nomeMae" type="text" size="60" maxlength="70"
							disabled="#{entidade.participante.codigo != null}" label="Nome da Mãe" />
					</h:column>
					<h:column>
						<h:outputLabel for="nomePai" value="Nome do Pai: " />
					</h:column>
					<h:column>
						<h:inputText class="inputContrast"
							value="#{entidade.participante.nomePai}" name="nomePai"
							disabled="#{entidade.participante.codigo != null}" id="nomePai" type="text"
							size="60" maxlength="70" />
					</h:column>
				</h:panelGrid>

				<span style="color: red;">(*)Campo de preenchimento
					obrigatório.</span> <br />
				<table border="1" width="30%" align="right">
					<tr>
						<td><h:commandButton action="#{componentView.voltar}"
								value="  Voltar  " immediate="true" /></td>
						<td><input type="button" value="  Limpar  " onclick="limpar()"/></td>
						<td><h:commandButton action="#{componentView.popUpParticipanteCadastrado}"
								value="  Próximo  "/></td>
					</tr>
				</table>
			</fieldset>
			<br />
		</div>
		<apabb:popupConfirmacao componentView="#{componentView}" form="formParticipante" />
		
		<script type="text/javascript">

			function setFocus(){
				document.getElementById('formParticipante:nome').focus();
			}

			function limpar(){
				document.getElementById('formParticipante:cpf').value = "";
				document.getElementById('formParticipante:nome').value = "";
				document.getElementById('formParticipante:nomeMae').value = "";
				document.getElementById('formParticipante:nomePai').value = "";
				document.getElementById('formParticipante:dtNascimentoInputDate').value = "";
				document.getElementById('formParticipante:cpf').focus();			
			}

		</script>
		
	</h:form>
</ui:composition>
